package com.oceanstar.controller;

import com.oceanstar.Pojo.AiSuggestionDTO;
import com.oceanstar.Pojo.Result;
import com.oceanstar.service.IAiSuggestionsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api")
@CrossOrigin(origins = "*")
public class AiSuggestionsController {

    @Autowired
    private IAiSuggestionsService aiHealthService;

    @PostMapping("/suggestions")
    public Result getHealthAdvice(@RequestHeader("token") String token) {
        String suggestion = aiHealthService.getHealthAdvice(token);
        AiSuggestionDTO dto = new AiSuggestionDTO();
        dto.setSuggestion(suggestion);
        return Result.success(dto);
    }
}